#include <iostream>
using namespace std;


int main(){
	int n,ans1=1,ans2=1;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++)
		cin>>h[i];
	
	int high,low;
	
	high = h[0];
	low = -1;
	for(int i=1;i<n;i++){
		if(high == -1){
			if(h[i] <= low)
				low = h[i];
			else
				low = -1,high = h[i],ans1++;
		}
		else{
			if(h[i] >= high)
				high = h[i];
			else
				high = -1,low = h[i],ans1++;
		}
	}
	
	high = -1;
	low = h[0];
	for(int i=1;i<n;i++){
		if(high == -1){
			if(h[i] <= low)
				low = h[i];
			else
				low = -1,high = h[i],ans2++;
		}
		else{
			if(h[i] >= high)
				high = h[i];
			else
				high = -1,low = h[i],ans2++;
		}
	}
	
	cout<<max(ans1,ans2);
	return 0;
}
